<!--自定义结算政策列表-->
<template>
  <div>
    <f-search-form :more='false' @searchHandler='searchHandler'>
      <f-search-form-item label='标题' name='policyTitle' />
    </f-search-form>
    <f-table ref='table' rowKey='policyFileId' :showSetting='true' setting-key='bonus_tab1' :tableColumns='columns' :scroll='{x:true}' :showMultipleBtn='false' :operator='operator' :multiple='multiple' :params='queryParam' :api='api.policy'>
      <span slot='filePath' slot-scope='text, record, index'>
        <f-images :value='record.filePath'></f-images>
      </span>
<!--      <span slot='status' slot-scope='text, record, index'>-->
<!--          <a-tag color="#FF0000" v-if="text==0">-->
<!--          已停用-->
<!--        </a-tag>-->
<!--        <a-tag color="#00FF00" v-if="text==1">-->
<!--          已启用-->
<!--        </a-tag>-->
<!--      </span>-->
      <span slot='action' slot-scope='text, record'>
          <template>
            <a href='javascript:;' @click='$refs.policyFileFormDrawer.showDrawer(record,"policyFileForm")'>编辑</a>
            <a-divider type='vertical' />
             <a-dropdown>
                <a class='ant-dropdown-link'>更多 <a-icon type='down' /></a>
                <a-menu slot='overlay'>
<!--                  <a-menu-item v-if='record.status==1'>-->
<!--                    <a href='javascript:;' @click='$refs.policyFileFormDrawer.showDrawer(record,"policyEndForm")'>停用</a>-->
<!--                  </a-menu-item>-->
                   <a-menu-item>
                <a href='javascript:;' @click='$refs.table.remove(record.policyFileId)'>删除</a>
              </a-menu-item>
                </a-menu>
              </a-dropdown>
          </template>
        </span>
    </f-table>
    <policy-file-form-drawer ref='policyFileFormDrawer'></policy-file-form-drawer>
  </div>
</template>
<script>
import api from "../../js/api"
import PolicyFileFormDrawer from "./components/file/policy_file_form_drawer"

export default {
  name: "Tab1",
  components: { PolicyFileFormDrawer },
  data() {
    let me = this
    //操作按钮
    let operator = []
    operator.push({
      name: "上传政策文件",
      icon: "plus",
      that: this,
      handler: (table, that) => {
        this.$refs.policyFileFormDrawer.showDrawer(table,"policyFileForm")
      }
    })
    return {
      api: Object.assign(api, this.api),
      multiple: false,
      deptId: "",
      //列表初始化查询参数
      queryParam: {},
      returnCustomBond: 0,
      selectIds: "",
      params1: {},
      columns: [
        {
          title: "序号",
          width: "60px",
          align: "center",
          customRender: (text, record, index) => index + 1
        },
        {
          title: "部门",
          align: "center",
          width: "100px",
          dataIndex: "deptName"
        },
        {
          title: "政策标题",
          align: "center",
          width: "200px",
          dataIndex: "policyTitle"
        },
        {
          title: "开始时间",
          align: "center",
          width: "120px",
          dataIndex: "beginDate"
        },
        {
          title: "结束时间",
          align: "center",
          width: "120px",
          dataIndex: "endDate"
        },
        {
          title: "文件附件",
          align: "center",
          width: "150px",
          dataIndex: "filePath",
          scopedSlots: { customRender: "filePath" }
        },
        // {
        //   title: "状态",
        //   align: "center",
        //   width: "60px",
        //   dataIndex: "status",
        //   scopedSlots: { customRender: "status" }
        // },
        {
          title: "备注",
          align: "center",
          ellipsis: true,
          width: "120px",
          dataIndex: "remark"
        }, {
          title: "操作",
          align: "center",
          width: "180px",
          dataIndex: "action",
          scopedSlots: { customRender: "action" }
        }
      ],
      operator: operator
    }
  },
  created() {
  },
  methods: {
    /**
     * 查询事件
     * @param searchParams
     */
    searchTable(searchParams) {
      this.queryParam = Object.assign(this.queryParam, searchParams)
      this.$refs.table.refresh(true, searchParams)
    },
    /**
     * 刷新列表
     */
    onLoad() {
      this.$refs.table.refresh()
      this.$emit("changeTab")
    }
  }
}
</script>